﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace CommonTagTime
{
    public static class clsValidate
    {
        public static string DEFAULT_FLOAT_VALIDATE_EXPRESSION = "^(\\+|\\-)?([0-9]+)(((\\.|\\,)?([0-9]+))?)$";
        public static string DEFAULT_INTERGER_VALIDATE_EXPRESSION = "^([0-9]+)$";
        public static string DEFAULT_PASSWORD_VALIDATE_EXPRESSION = "^(?=.*[a-zA-Z]+|[0-9])(?!.*\\s).{4,10}$";
        public static string DEFAULT_URL_VALIDATE_EXPRESSION = "^http(s?)://([^$@\\ ]+)$";
        public static string DEFAULT_ZIPCODE_VALIDATE_EXPRESSION = "^\\d{5}(-?\\d{4})?$";
        public static string DEFAULT_PHONE_VALIDATE_EXPRESSION = "^\\d{3}-\\d{3}-\\d{4}$";    
        public static string DEFAULT_EMAIL_VALIDATE_EXPRESSION = "^[A-Za-z0-9]+[A-Za-z0-9_\\-\\.]*\\@([A-Za-z0-9\\-]+\\.)+[A-Za-z]{2,5}$";
        public static string DEFAULT_USERNAME_VALIDATE_EXPRESSION = "^[a-zA-Z0-9_.-]{4,12}$";    
    
        

        public static bool CheckFloatValid(string value)
        {
            Regex floatPattern = new Regex(DEFAULT_FLOAT_VALIDATE_EXPRESSION);
            return floatPattern.IsMatch(value); 
        }
        public static bool CheckPostalCodeValid(string value)
        {
            Regex floatPattern = new Regex(DEFAULT_ZIPCODE_VALIDATE_EXPRESSION);
            return floatPattern.IsMatch(value);
        }
        public static bool CheckPhoneValid(string value)
        {
            Regex floatPattern = new Regex(DEFAULT_PHONE_VALIDATE_EXPRESSION);
            return floatPattern.IsMatch(value);
        }
        public static bool CheckEmailValid(string value)
        {
            Regex floatPattern = new Regex(DEFAULT_EMAIL_VALIDATE_EXPRESSION);
            return floatPattern.IsMatch(value);
        }
        public static bool CheckUserNameValid(string value)
        {
            Regex pattern = new Regex(DEFAULT_USERNAME_VALIDATE_EXPRESSION);
            return pattern.IsMatch(value);
        }
      
    }
}
